Integrand size = 31, antiderivative size = 344 \[ \int \cos (c+d x) \sqrt {a+b \sec (c+d x)} (A+B \sec (c+d x)) \, dx=\frac {A (a-b) \sqrt {a+b} \cot (c+d x) E\left (\arcsin \left (\frac {\sqrt {a+b \sec (c+d x)}}{\sqrt {a+b}}\right )|\frac {a+b}{a-b}\right ) \sqrt {\frac {b (1-\sec (c+d x))}{a+b}} \sqrt {-\frac {b (1+\sec (c+d x))}{a-b}}}{b d}+\frac {\sqrt {a+b} (A+2 B) \cot (c+d x) \operatorname {EllipticF}\left (\arcsin \left (\frac {\sqrt {a+b \sec (c+d x)}}{\sqrt {a+b}}\right ),\frac {a+b}{a-b}\right ) \sqrt {\frac {b (1-\sec (c+d x))}{a+b}} \sqrt {-\frac {b (1+\sec (c+d x))}{a-b}}}{d}-\frac {\sqrt {a+b} (A b+2 a B) \cot (c+d x) \operatorname {EllipticPi}\left (\frac {a+b}{a},\arcsin \left (\frac {\sqrt {a+b \sec (c+d x)}}{\sqrt {a+b}}\right ),\frac {a+b}{a-b}\right ) \sqrt {\frac {b (1-\sec (c+d x))}{a+b}} \sqrt {-\frac {b (1+\sec (c+d x))}{a-b}}}{a d}+\frac {A \sqrt {a+b \sec (c+d x)} \sin (c+d x)}{d} \]
A*(a-b)*cot(d*x+c)*EllipticE((a+b*sec(d*x+c))^(1/2)/(a+b)^(1/2),((a+b)/(a- b))^(1/2))*(a+b)^(1/2)*(b*(1-sec(d*x+c))/(a+b))^(1/2)*(-b*(1+sec(d*x+c))/( a-b))^(1/2)/b/d+(A+2*B)*cot(d*x+c)*EllipticF((a+b*sec(d*x+c))^(1/2)/(a+b)^ (1/2),((a+b)/(a-b))^(1/2))*(a+b)^(1/2)*(b*(1-sec(d*x+c))/(a+b))^(1/2)*(-b* (1+sec(d*x+c))/(a-b))^(1/2)/d-(A*b+2*B*a)*cot(d*x+c)*EllipticPi((a+b*sec(d *x+c))^(1/2)/(a+b)^(1/2),(a+b)/a,((a+b)/(a-b))^(1/2))*(a+b)^(1/2)*(b*(1-se c(d*x+c))/(a+b))^(1/2)*(-b*(1+sec(d*x+c))/(a-b))^(1/2)/a/d+A*sin(d*x+c)*(a +b*sec(d*x+c))^(1/2)/d
Leaf count is larger than twice the leaf count of optimal. \(843\) vs. \(2(344)=688\).
Time = 14.74 (sec) , antiderivative size = 843, normalized size of antiderivative = 2.45 \[ \int \cos (c+d x) \sqrt {a+b \sec (c+d x)} (A+B \sec (c+d x)) \, dx=\frac {\sqrt {a+b \sec (c+d x)} \sqrt {\frac {a+b-a \tan ^2\left (\frac {1}{2} (c+d x)\right )+b \tan ^2\left (\frac {1}{2} (c+d x)\right )}{1+\tan ^2\left (\frac {1}{2} (c+d x)\right )}} \left (a A \tan \left (\frac {1}{2} (c+d x)\right )+A b \tan \left (\frac {1}{2} (c+d x)\right )-2 a A \tan ^3\left (\frac {1}{2} (c+d x)\right )+a A \tan ^5\left (\frac {1}{2} (c+d x)\right )-A b \tan ^5\left (\frac {1}{2} (c+d x)\right )+2 A b \operatorname {EllipticPi}\left (-1,\arcsin \left (\tan \left (\frac {1}{2} (c+d x)\right )\right ),\frac {a-b}{a+b}\right ) \sqrt {1-\tan ^2\left (\frac {1}{2} (c+d x)\right )} \sqrt {\frac {a+b-a \tan ^2\left (\frac {1}{2} (c+d x)\right )+b \tan ^2\left (\frac {1}{2} (c+d x)\right )}{a+b}}+4 a B \operatorname {EllipticPi}\left (-1,\arcsin \left (\tan \left (\frac {1}{2} (c+d x)\right )\right ),\frac {a-b}{a+b}\right ) \sqrt {1-\tan ^2\left (\frac {1}{2} (c+d x)\right )} \sqrt {\frac {a+b-a \tan ^2\left (\frac {1}{2} (c+d x)\right )+b \tan ^2\left (\frac {1}{2} (c+d x)\right )}{a+b}}+2 A b \operatorname {EllipticPi}\left (-1,\arcsin \left (\tan \left (\frac {1}{2} (c+d x)\right )\right ),\frac {a-b}{a+b}\right ) \tan ^2\left (\frac {1}{2} (c+d x)\right ) \sqrt {1-\tan ^2\left (\frac {1}{2} (c+d x)\right )} \sqrt {\frac {a+b-a \tan ^2\left (\frac {1}{2} (c+d x)\right )+b \tan ^2\left (\frac {1}{2} (c+d x)\right )}{a+b}}+4 a B \operatorname {EllipticPi}\left (-1,\arcsin \left (\tan \left (\frac {1}{2} (c+d x)\right )\right ),\frac {a-b}{a+b}\right ) \tan ^2\left (\frac {1}{2} (c+d x)\right ) \sqrt {1-\tan ^2\left (\frac {1}{2} (c+d x)\right )} \sqrt {\frac {a+b-a \tan ^2\left (\frac {1}{2} (c+d x)\right )+b \tan ^2\left (\frac {1}{2} (c+d x)\right )}{a+b}}+A (a+b) E\left (\arcsin \left (\tan \left (\frac {1}{2} (c+d x)\right )\right )|\frac {a-b}{a+b}\right ) \sqrt {1-\tan ^2\left (\frac {1}{2} (c+d x)\right )} \left (1+\tan ^2\left (\frac {1}{2} (c+d x)\right )\right ) \sqrt {\frac {a+b-a \tan ^2\left (\frac {1}{2} (c+d x)\right )+b \tan ^2\left (\frac {1}{2} (c+d x)\right )}{a+b}}-2 (A b+(a-b) B) \operatorname {EllipticF}\left (\arcsin \left (\tan \left (\frac {1}{2} (c+d x)\right )\right ),\frac {a-b}{a+b}\right ) \sqrt {1-\tan ^2\left (\frac {1}{2} (c+d x)\right )} \left (1+\tan ^2\left (\frac {1}{2} (c+d x)\right )\right ) \sqrt {\frac {a+b-a \tan ^2\left (\frac {1}{2} (c+d x)\right )+b \tan ^2\left (\frac {1}{2} (c+d x)\right )}{a+b}}\right )}{d \sqrt {b+a \cos (c+d x)} \sqrt {\sec (c+d x)} \sqrt {\frac {1+\tan ^2\left (\frac {1}{2} (c+d x)\right )}{1-\tan ^2\left (\frac {1}{2} (c+d x)\right )}} \left (b-b \tan ^4\left (\frac {1}{2} (c+d x)\right )+a \left (-1+\tan ^2\left (\frac {1}{2} (c+d x)\right )\right )^2\right )} \]
(Sqrt[a + b*Sec[c + d*x]]*Sqrt[(a + b - a*Tan[(c + d*x)/2]^2 + b*Tan[(c + d*x)/2]^2)/(1 + Tan[(c + d*x)/2]^2)]*(a*A*Tan[(c + d*x)/2] + A*b*Tan[(c + d*x)/2] - 2*a*A*Tan[(c + d*x)/2]^3 + a*A*Tan[(c + d*x)/2]^5 - A*b*Tan[(c + d*x)/2]^5 + 2*A*b*EllipticPi[-1, ArcSin[Tan[(c + d*x)/2]], (a - b)/(a + b )]*Sqrt[1 - Tan[(c + d*x)/2]^2]*Sqrt[(a + b - a*Tan[(c + d*x)/2]^2 + b*Tan [(c + d*x)/2]^2)/(a + b)] + 4*a*B*EllipticPi[-1, ArcSin[Tan[(c + d*x)/2]], (a - b)/(a + b)]*Sqrt[1 - Tan[(c + d*x)/2]^2]*Sqrt[(a + b - a*Tan[(c + d* x)/2]^2 + b*Tan[(c + d*x)/2]^2)/(a + b)] + 2*A*b*EllipticPi[-1, ArcSin[Tan [(c + d*x)/2]], (a - b)/(a + b)]*Tan[(c + d*x)/2]^2*Sqrt[1 - Tan[(c + d*x) /2]^2]*Sqrt[(a + b - a*Tan[(c + d*x)/2]^2 + b*Tan[(c + d*x)/2]^2)/(a + b)] + 4*a*B*EllipticPi[-1, ArcSin[Tan[(c + d*x)/2]], (a - b)/(a + b)]*Tan[(c + d*x)/2]^2*Sqrt[1 - Tan[(c + d*x)/2]^2]*Sqrt[(a + b - a*Tan[(c + d*x)/2]^ 2 + b*Tan[(c + d*x)/2]^2)/(a + b)] + A*(a + b)*EllipticE[ArcSin[Tan[(c + d *x)/2]], (a - b)/(a + b)]*Sqrt[1 - Tan[(c + d*x)/2]^2]*(1 + Tan[(c + d*x)/ 2]^2)*Sqrt[(a + b - a*Tan[(c + d*x)/2]^2 + b*Tan[(c + d*x)/2]^2)/(a + b)] - 2*(A*b + (a - b)*B)*EllipticF[ArcSin[Tan[(c + d*x)/2]], (a - b)/(a + b)] *Sqrt[1 - Tan[(c + d*x)/2]^2]*(1 + Tan[(c + d*x)/2]^2)*Sqrt[(a + b - a*Tan [(c + d*x)/2]^2 + b*Tan[(c + d*x)/2]^2)/(a + b)]))/(d*Sqrt[b + a*Cos[c + d *x]]*Sqrt[Sec[c + d*x]]*Sqrt[(1 + Tan[(c + d*x)/2]^2)/(1 - Tan[(c + d*x)/2 ]^2)]*(b - b*Tan[(c + d*x)/2]^4 + a*(-1 + Tan[(c + d*x)/2]^2)^2))
Time = 1.34 (sec) , antiderivative size = 351, normalized size of antiderivative = 1.02, number of steps used = 11, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.355, Rules used = {3042, 4520, 27, 3042, 4546, 3042, 4409, 3042, 4271, 4319, 4492}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \cos (c+d x) \sqrt {a+b \sec (c+d x)} (A+B \sec (c+d x)) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\sqrt {a+b \csc \left (c+d x+\frac {\pi }{2}\right )} \left (A+B \csc \left (c+d x+\frac {\pi }{2}\right )\right )}{\csc \left (c+d x+\frac {\pi }{2}\right )}dx\) |
\(\Big \downarrow \) 4520 |
\(\displaystyle \int \frac {-A b \sec ^2(c+d x)+2 b B \sec (c+d x)+A b+2 a B}{2 \sqrt {a+b \sec (c+d x)}}dx+\frac {A \sin (c+d x) \sqrt {a+b \sec (c+d x)}}{d}\) |
\(\Big \downarrow \) 27 |
\(\displaystyle \frac {1}{2} \int \frac {-A b \sec ^2(c+d x)+2 b B \sec (c+d x)+A b+2 a B}{\sqrt {a+b \sec (c+d x)}}dx+\frac {A \sin (c+d x) \sqrt {a+b \sec (c+d x)}}{d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{2} \int \frac {-A b \csc \left (c+d x+\frac {\pi }{2}\right )^2+2 b B \csc \left (c+d x+\frac {\pi }{2}\right )+A b+2 a B}{\sqrt {a+b \csc \left (c+d x+\frac {\pi }{2}\right )}}dx+\frac {A \sin (c+d x) \sqrt {a+b \sec (c+d x)}}{d}\) |
\(\Big \downarrow \) 4546 |
\(\displaystyle \frac {1}{2} \left (\int \frac {A b+2 a B+(A b+2 B b) \sec (c+d x)}{\sqrt {a+b \sec (c+d x)}}dx-A b \int \frac {\sec (c+d x) (\sec (c+d x)+1)}{\sqrt {a+b \sec (c+d x)}}dx\right )+\frac {A \sin (c+d x) \sqrt {a+b \sec (c+d x)}}{d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{2} \left (\int \frac {A b+2 a B+(A b+2 B b) \csc \left (c+d x+\frac {\pi }{2}\right )}{\sqrt {a+b \csc \left (c+d x+\frac {\pi }{2}\right )}}dx-A b \int \frac {\csc \left (c+d x+\frac {\pi }{2}\right ) \left (\csc \left (c+d x+\frac {\pi }{2}\right )+1\right )}{\sqrt {a+b \csc \left (c+d x+\frac {\pi }{2}\right )}}dx\right )+\frac {A \sin (c+d x) \sqrt {a+b \sec (c+d x)}}{d}\) |
\(\Big \downarrow \) 4409 |
\(\displaystyle \frac {1}{2} \left ((2 a B+A b) \int \frac {1}{\sqrt {a+b \sec (c+d x)}}dx+b (A+2 B) \int \frac {\sec (c+d x)}{\sqrt {a+b \sec (c+d x)}}dx-A b \int \frac {\csc \left (c+d x+\frac {\pi }{2}\right ) \left (\csc \left (c+d x+\frac {\pi }{2}\right )+1\right )}{\sqrt {a+b \csc \left (c+d x+\frac {\pi }{2}\right )}}dx\right )+\frac {A \sin (c+d x) \sqrt {a+b \sec (c+d x)}}{d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{2} \left ((2 a B+A b) \int \frac {1}{\sqrt {a+b \csc \left (c+d x+\frac {\pi }{2}\right )}}dx+b (A+2 B) \int \frac {\csc \left (c+d x+\frac {\pi }{2}\right )}{\sqrt {a+b \csc \left (c+d x+\frac {\pi }{2}\right )}}dx-A b \int \frac {\csc \left (c+d x+\frac {\pi }{2}\right ) \left (\csc \left (c+d x+\frac {\pi }{2}\right )+1\right )}{\sqrt {a+b \csc \left (c+d x+\frac {\pi }{2}\right )}}dx\right )+\frac {A \sin (c+d x) \sqrt {a+b \sec (c+d x)}}{d}\) |
\(\Big \downarrow \) 4271 |
\(\displaystyle \frac {1}{2} \left (b (A+2 B) \int \frac {\csc \left (c+d x+\frac {\pi }{2}\right )}{\sqrt {a+b \csc \left (c+d x+\frac {\pi }{2}\right )}}dx-A b \int \frac {\csc \left (c+d x+\frac {\pi }{2}\right ) \left (\csc \left (c+d x+\frac {\pi }{2}\right )+1\right )}{\sqrt {a+b \csc \left (c+d x+\frac {\pi }{2}\right )}}dx-\frac {2 \sqrt {a+b} (2 a B+A b) \cot (c+d x) \sqrt {\frac {b (1-\sec (c+d x))}{a+b}} \sqrt {-\frac {b (\sec (c+d x)+1)}{a-b}} \operatorname {EllipticPi}\left (\frac {a+b}{a},\arcsin \left (\frac {\sqrt {a+b \sec (c+d x)}}{\sqrt {a+b}}\right ),\frac {a+b}{a-b}\right )}{a d}\right )+\frac {A \sin (c+d x) \sqrt {a+b \sec (c+d x)}}{d}\) |
\(\Big \downarrow \) 4319 |
\(\displaystyle \frac {1}{2} \left (-A b \int \frac {\csc \left (c+d x+\frac {\pi }{2}\right ) \left (\csc \left (c+d x+\frac {\pi }{2}\right )+1\right )}{\sqrt {a+b \csc \left (c+d x+\frac {\pi }{2}\right )}}dx+\frac {2 \sqrt {a+b} (A+2 B) \cot (c+d x) \sqrt {\frac {b (1-\sec (c+d x))}{a+b}} \sqrt {-\frac {b (\sec (c+d x)+1)}{a-b}} \operatorname {EllipticF}\left (\arcsin \left (\frac {\sqrt {a+b \sec (c+d x)}}{\sqrt {a+b}}\right ),\frac {a+b}{a-b}\right )}{d}-\frac {2 \sqrt {a+b} (2 a B+A b) \cot (c+d x) \sqrt {\frac {b (1-\sec (c+d x))}{a+b}} \sqrt {-\frac {b (\sec (c+d x)+1)}{a-b}} \operatorname {EllipticPi}\left (\frac {a+b}{a},\arcsin \left (\frac {\sqrt {a+b \sec (c+d x)}}{\sqrt {a+b}}\right ),\frac {a+b}{a-b}\right )}{a d}\right )+\frac {A \sin (c+d x) \sqrt {a+b \sec (c+d x)}}{d}\) |
\(\Big \downarrow \) 4492 |
\(\displaystyle \frac {1}{2} \left (\frac {2 \sqrt {a+b} (A+2 B) \cot (c+d x) \sqrt {\frac {b (1-\sec (c+d x))}{a+b}} \sqrt {-\frac {b (\sec (c+d x)+1)}{a-b}} \operatorname {EllipticF}\left (\arcsin \left (\frac {\sqrt {a+b \sec (c+d x)}}{\sqrt {a+b}}\right ),\frac {a+b}{a-b}\right )}{d}-\frac {2 \sqrt {a+b} (2 a B+A b) \cot (c+d x) \sqrt {\frac {b (1-\sec (c+d x))}{a+b}} \sqrt {-\frac {b (\sec (c+d x)+1)}{a-b}} \operatorname {EllipticPi}\left (\frac {a+b}{a},\arcsin \left (\frac {\sqrt {a+b \sec (c+d x)}}{\sqrt {a+b}}\right ),\frac {a+b}{a-b}\right )}{a d}+\frac {2 A (a-b) \sqrt {a+b} \cot (c+d x) \sqrt {\frac {b (1-\sec (c+d x))}{a+b}} \sqrt {-\frac {b (\sec (c+d x)+1)}{a-b}} E\left (\arcsin \left (\frac {\sqrt {a+b \sec (c+d x)}}{\sqrt {a+b}}\right )|\frac {a+b}{a-b}\right )}{b d}\right )+\frac {A \sin (c+d x) \sqrt {a+b \sec (c+d x)}}{d}\) |
((2*A*(a - b)*Sqrt[a + b]*Cot[c + d*x]*EllipticE[ArcSin[Sqrt[a + b*Sec[c + d*x]]/Sqrt[a + b]], (a + b)/(a - b)]*Sqrt[(b*(1 - Sec[c + d*x]))/(a + b)] *Sqrt[-((b*(1 + Sec[c + d*x]))/(a - b))])/(b*d) + (2*Sqrt[a + b]*(A + 2*B) *Cot[c + d*x]*EllipticF[ArcSin[Sqrt[a + b*Sec[c + d*x]]/Sqrt[a + b]], (a + b)/(a - b)]*Sqrt[(b*(1 - Sec[c + d*x]))/(a + b)]*Sqrt[-((b*(1 + Sec[c + d *x]))/(a - b))])/d - (2*Sqrt[a + b]*(A*b + 2*a*B)*Cot[c + d*x]*EllipticPi[ (a + b)/a, ArcSin[Sqrt[a + b*Sec[c + d*x]]/Sqrt[a + b]], (a + b)/(a - b)]* Sqrt[(b*(1 - Sec[c + d*x]))/(a + b)]*Sqrt[-((b*(1 + Sec[c + d*x]))/(a - b) )])/(a*d))/2 + (A*Sqrt[a + b*Sec[c + d*x]]*Sin[c + d*x])/d
3.4.53.3.1 Defintions of rubi rules used
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
Int[1/Sqrt[csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Simp[2*(Rt[a + b, 2]/(a*d*Cot[c + d*x]))*Sqrt[b*((1 - Csc[c + d*x])/(a + b))]*Sqrt[(-b) *((1 + Csc[c + d*x])/(a - b))]*EllipticPi[(a + b)/a, ArcSin[Sqrt[a + b*Csc[ c + d*x]]/Rt[a + b, 2]], (a + b)/(a - b)], x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 - b^2, 0]
Int[csc[(e_.) + (f_.)*(x_)]/Sqrt[csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)], x_S ymbol] :> Simp[-2*(Rt[a + b, 2]/(b*f*Cot[e + f*x]))*Sqrt[(b*(1 - Csc[e + f* x]))/(a + b)]*Sqrt[(-b)*((1 + Csc[e + f*x])/(a - b))]*EllipticF[ArcSin[Sqrt [a + b*Csc[e + f*x]]/Rt[a + b, 2]], (a + b)/(a - b)], x] /; FreeQ[{a, b, e, f}, x] && NeQ[a^2 - b^2, 0]
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))/Sqrt[csc[(e_.) + (f_.)*(x_)]*(b_ .) + (a_)], x_Symbol] :> Simp[c Int[1/Sqrt[a + b*Csc[e + f*x]], x], x] + Simp[d Int[Csc[e + f*x]/Sqrt[a + b*Csc[e + f*x]], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0]
Int[(csc[(e_.) + (f_.)*(x_)]*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)))/Sqrt[c sc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Simp[-2*(A*b - a*B)*Rt[a + b*(B/A), 2]*Sqrt[b*((1 - Csc[e + f*x])/(a + b))]*(Sqrt[(-b)*((1 + Csc[e + f*x])/(a - b))]/(b^2*f*Cot[e + f*x]))*EllipticE[ArcSin[Sqrt[a + b*Csc[e + f*x]]/Rt[a + b*(B/A), 2]], (a*A + b*B)/(a*A - b*B)], x] /; FreeQ[{a, b, e, f, A, B}, x] && NeQ[a^2 - b^2, 0] && EqQ[A^2 - B^2, 0]
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + ( a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[A*Cot[e + f*x]*(a + b*Csc[e + f*x])^m*((d*Csc[e + f*x])^n/(f*n)), x] - Simp[1/(d*n ) Int[(a + b*Csc[e + f*x])^(m - 1)*(d*Csc[e + f*x])^(n + 1)*Simp[A*b*m - a*B*n - (b*B*n + a*A*(n + 1))*Csc[e + f*x] - A*b*(m + n + 1)*Csc[e + f*x]^2 , x], x], x] /; FreeQ[{a, b, d, e, f, A, B}, x] && NeQ[A*b - a*B, 0] && NeQ [a^2 - b^2, 0] && LtQ[0, m, 1] && LeQ[n, -1]
Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_. ))/Sqrt[csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Int[(A + (B - C )*Csc[e + f*x])/Sqrt[a + b*Csc[e + f*x]], x] + Simp[C Int[Csc[e + f*x]*(( 1 + Csc[e + f*x])/Sqrt[a + b*Csc[e + f*x]]), x], x] /; FreeQ[{a, b, e, f, A , B, C}, x] && NeQ[a^2 - b^2, 0]
Leaf count of result is larger than twice the leaf count of optimal. \(1854\) vs. \(2(315)=630\).
Time = 10.47 (sec) , antiderivative size = 1855, normalized size of antiderivative = 5.39
-1/d*(A*EllipticE(cot(d*x+c)-csc(d*x+c),((a-b)/(a+b))^(1/2))*(cos(d*x+c)/( cos(d*x+c)+1))^(1/2)*(1/(a+b)*(b+a*cos(d*x+c))/(cos(d*x+c)+1))^(1/2)*a*cos (d*x+c)^2+A*EllipticE(cot(d*x+c)-csc(d*x+c),((a-b)/(a+b))^(1/2))*(cos(d*x+ c)/(cos(d*x+c)+1))^(1/2)*(1/(a+b)*(b+a*cos(d*x+c))/(cos(d*x+c)+1))^(1/2)*b *cos(d*x+c)^2+2*A*EllipticPi(cot(d*x+c)-csc(d*x+c),-1,((a-b)/(a+b))^(1/2)) *(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*(1/(a+b)*(b+a*cos(d*x+c))/(cos(d*x+c)+1 ))^(1/2)*b*cos(d*x+c)^2-2*A*(1/(a+b)*(b+a*cos(d*x+c))/(cos(d*x+c)+1))^(1/2 )*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*EllipticF(cot(d*x+c)-csc(d*x+c),((a-b) /(a+b))^(1/2))*b*cos(d*x+c)^2+4*B*EllipticPi(cot(d*x+c)-csc(d*x+c),-1,((a- b)/(a+b))^(1/2))*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*(1/(a+b)*(b+a*cos(d*x+c ))/(cos(d*x+c)+1))^(1/2)*a*cos(d*x+c)^2-2*B*(1/(a+b)*(b+a*cos(d*x+c))/(cos (d*x+c)+1))^(1/2)*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*EllipticF(cot(d*x+c)-c sc(d*x+c),((a-b)/(a+b))^(1/2))*a*cos(d*x+c)^2+2*B*(1/(a+b)*(b+a*cos(d*x+c) )/(cos(d*x+c)+1))^(1/2)*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*EllipticF(cot(d* x+c)-csc(d*x+c),((a-b)/(a+b))^(1/2))*b*cos(d*x+c)^2+2*A*EllipticE(cot(d*x+ c)-csc(d*x+c),((a-b)/(a+b))^(1/2))*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*(1/(a +b)*(b+a*cos(d*x+c))/(cos(d*x+c)+1))^(1/2)*a*cos(d*x+c)+2*A*EllipticE(cot( d*x+c)-csc(d*x+c),((a-b)/(a+b))^(1/2))*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*( 1/(a+b)*(b+a*cos(d*x+c))/(cos(d*x+c)+1))^(1/2)*b*cos(d*x+c)+4*A*EllipticPi (cot(d*x+c)-csc(d*x+c),-1,((a-b)/(a+b))^(1/2))*(cos(d*x+c)/(cos(d*x+c)+...
\[ \int \cos (c+d x) \sqrt {a+b \sec (c+d x)} (A+B \sec (c+d x)) \, dx=\int { {\left (B \sec \left (d x + c\right ) + A\right )} \sqrt {b \sec \left (d x + c\right ) + a} \cos \left (d x + c\right ) \,d x } \]
\[ \int \cos (c+d x) \sqrt {a+b \sec (c+d x)} (A+B \sec (c+d x)) \, dx=\int \left (A + B \sec {\left (c + d x \right )}\right ) \sqrt {a + b \sec {\left (c + d x \right )}} \cos {\left (c + d x \right )}\, dx \]
\[ \int \cos (c+d x) \sqrt {a+b \sec (c+d x)} (A+B \sec (c+d x)) \, dx=\int { {\left (B \sec \left (d x + c\right ) + A\right )} \sqrt {b \sec \left (d x + c\right ) + a} \cos \left (d x + c\right ) \,d x } \]
\[ \int \cos (c+d x) \sqrt {a+b \sec (c+d x)} (A+B \sec (c+d x)) \, dx=\int { {\left (B \sec \left (d x + c\right ) + A\right )} \sqrt {b \sec \left (d x + c\right ) + a} \cos \left (d x + c\right ) \,d x } \]
Timed out. \[ \int \cos (c+d x) \sqrt {a+b \sec (c+d x)} (A+B \sec (c+d x)) \, dx=\int \cos \left (c+d\,x\right )\,\left (A+\frac {B}{\cos \left (c+d\,x\right )}\right )\,\sqrt {a+\frac {b}{\cos \left (c+d\,x\right )}} \,d x \]